<?php
namespace Lib\Source;
use Lib\Data;

interface DriverInterface{
    /**
     * Loads data from Storage to Data
     * 
     * @param string $name
     * @param mixed $default
     * @return Data
     */
    public function load($name, $default);
    
    /**
     * Saves Data to Storage
     * 
     * @param mixed $name
     * @param mixed $value
     * @param array $options
     * @return bool
     */
    public function save($name, $value);
    
    /**
     * Retrieves or creates local storage
     * 
     * @return Lib\Data
     */
    public function getStorage();
    
    /**
     * Writes data to storage
     * 
     * @param Data $data
     */
    public function setStorage(Data $data);
    
    /**
     * Appends data to storage
     * 
     * @param Data $data
     */
    public function appendStorage(Data $data);
    /**
     * Sets options for current driver
     * 
     * @param array $options
     */
    public function setOptions($options);
    
    /**
     * Get options
     * 
     * @return Data
     */
    public function getOptions();
    
    /**
     * Get setted option
     * 
     * @param string $name
     * @param mixed $default
     * @return mixed
     */
    public function getOption($name, $default);
    
    /**
     * Saves all data to physical storage
     * 
     * @param Data $data
     * @return bool
     */
    public function saveData($data);
}